"use strict";
/**
 * @ Author: Yoann Meclot. MSay2
 * @ Created on: 2020-09-03 13:21:55
 * @ Modified on: 2020-10-01 12:39:39
 *
 * @version 1.1
 */
/**
 * Copyright (c) 2020 MSay2, Yoann Meclot - @msay2/tspoet
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.TSAnnotation = void 0;
const ArrayList_js_1 = require("../utils/ArrayList.js");
const Utils_js_1 = require("../utils/Utils.js");
/**
 * Init a new annotation.
 *
 * @class TSAnnotation
 * @version 1.0
 */
class TSAnnotation {
    constructor(builder) {
        this.name = Utils_js_1.Utils.checkNotNull(builder.name, "TSAnnotation must have a non-null annotation name.");
        this.values = Utils_js_1.Utils.checkNotNull(builder.values, "TSAnnotation must have a non-null values.");
    }
    /**
     * Add the name of the annotation.
     *
     * @param name The name of the annotation.
     * @throws {NullPointerException} Check if the name is null.
     * @type {Builder}
     * @since 1.0
     */
    static add(name) {
        return new Builder(name);
    }
    emit(codeWriter) {
        codeWriter.emitAnnotation(this);
        return codeWriter;
    }
}
exports.TSAnnotation = TSAnnotation;
/**
 * Init a empty annotation.
 *
 * @type {string}
 * @since 1.0
 */
TSAnnotation.EMPTY_VALUE = "ANNOTATION_NO_VALUE";
/**
 * @version 1.0
 */
class Builder {
    constructor(name) {
        this.values = new ArrayList_js_1.ArrayList();
        this.name = Utils_js_1.Utils.checkNotNull(name, "TSAnnotation must have a non-null annotation name.");
    }
    /**
     * Add value to the annotation.
     *
     * @param value The value of annotation.
     * @throws {NullPointerException} Check if the value is null.
     * @type {Builder}
     * @since 1.0
     */
    addValue(value) {
        this.values.add(Utils_js_1.Utils.checkNotNull(value, "TSAnnotation must have a non-null value."));
        return this;
    }
    /**
     * Build a annotation.
     *
     * @throws {NullPointerException} Check if the name is null.
     * @throws {NullPointerException} Check is the values is null.
     * @type {TSAnnotation}
     * @since 1.0
     */
    build() {
        return new TSAnnotation(this);
    }
}
//# sourceMappingURL=TSAnnotation.js.map